<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNewFlowOrders extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('new_flow_orders', function (Blueprint $table) {
            $table->comment = '流程订单表';
            $table->increments('id');
            $table->unsignedInteger('loan_requests_id')->comment('授信id');
            $table->unsignedInteger('user_id')->comment('用户id');
            $table->string('phone')->comment('用户手机号');
            $table->string('num')->comment('身份证号');
            $table->string('name')->comment('姓名');
            $table->string('source')->default('')->comment('渠道id');
            $table->string('product_name')->comment('产品名称');
            $table->integer('user_apply_limit')->default(0)->comment('用户申请额度');
            $table->timestamp('user_apply_time')->nullable()->comment('用户提交时间');
            $table->timestamp('risk_apply_time')->nullable()->comment('风控申请时间');
            $table->timestamp('risk_result_time')->nullable()->comment('风控返回时间');
            $table->integer('risk_result_limit')->default(0)->comment('风控返回额度');
            $table->tinyInteger('risk_status')->nullable()->comment('风控返回状态');
            $table->timestamp('loan_request_apply_time')->nullable()->comment('授信申请时间');
            $table->timestamp('loan_request_result_time')->nullable()->comment('授信返回时间');
            $table->tinyInteger('loan_request_status')->nullable()->comment('授信返回状态');
            $table->integer('loan_request_limit')->default(0)->comment('授信成功返回额度');
            $table->timestamp('loan_commit_time')->nullable()->comment('确认要款时间');
            $table->tinyInteger('loan_status')->nullable()->comment('放款状态');
            $table->timestamp('loan_time')->nullable()->comment('放款时间');
            $table->integer('loan_limit')->default(0)->comment('放款金额');
            $table->string('capital_name')->default('')->comment('资方名称');
            $table->string('message')->default('')->comment('返回信息');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('new_flow_orders');
    }
}
